package com.gskinner.controls {
	
	import flash.text.StyleSheet;
	import flash.text.TextFieldAutoSize;
	
	import mx.controls.Text;
	import mx.core.mx_internal;
	import mx.core.IUITextField;

	use namespace mx_internal;
	
	public class HTMLText extends Text {
		
		protected var _embedFonts:Boolean;
		
		public function setStyleSheet(p_styleSheet:StyleSheet, p_embedFonts:Boolean = true):void {
			styleSheet = p_styleSheet;
			
			_embedFonts = p_embedFonts;
			textField.embedFonts = p_embedFonts;
		}
		
		public function get field():IUITextField {
			return textField;
		}
		
		override  mx_internal function createTextField(childIndex:int):void {
			super.mx_internal::createTextField(childIndex);
			
			textField.embedFonts = _embedFonts;
			textField.multiline = true;
			textField.autoSize = TextFieldAutoSize.LEFT;
		}
	}
}